package com.bigdata.spark.testapp.JsonTest

import java.text.SimpleDateFormat
import java.util.{Date, Random}

import scala.collection.mutable.ListBuffer

object JsonTest {
  def main(args: Array[String]): Unit = {

    val dare: String = new SimpleDateFormat("yyyy-MM-dd HH").format(new Date(1630930564271L))
    print(dare)

    val list = ListBuffer[String]()
    val areaList = ListBuffer[String]("华北", "华东", "华南")
    val cityList = ListBuffer[String]("北京", "上海", "深圳")
    val sexList = ListBuffer[String]("男", "女", "无")

    for ( i <- 1 to new Random().nextInt(2) ) {

      val area = areaList(new Random().nextInt(3))
      val city = cityList(new Random().nextInt(3))

      var userid = new Random().nextInt(6) + 1

      var username = new Random().nextInt(6) + 1

      var sex = cityList(new Random().nextInt(3))

      var phone = "112344321"

      var jstr = "{\"start\":{" +
        "\"userid\""+":\"" + userid + '\"'+
        ",\"username\"" +":\""+ username + '\"' +
        ",\"sex\"" + ":\""+sex + '\"'+
        ",\"phone\"" +":\""+ phone + '\"' +
        ",\"ts\"" +":"+ System.currentTimeMillis() +
        '}'+'}'


      list.append(jstr)
    }

    println(list)

  }
}
